#include "BankSystem.hh"
#include "2_RegisterNewCustomer.hh"
#include "3_AccessCustomerAccounts.hh"

// 主菜单
void showMainMenu(BankSystem::BankSystem& bankSystem) {
    while (true) {
        system("clear"); // 在Linux/Mac上清屏，Windows上用system("cls")
        SetConsoleOutputCP(CP_UTF8);
        std::cout << "===== Banking System =====" << std::endl;
        std::cout << "1. Register new customer" << std::endl;
        std::cout << "2. Access customer accounts" << std::endl;
        std::cout << "3. Display all bank accounts" << std::endl;
        std::cout << "4. Transaction reports" << std::endl;
        std::cout << "5. Exit" << std::endl;
        std::cout << "Please choose: ";
        
        int choice;
        std::cin >> choice;
        clearInputBuffer();
        
        switch (choice) {
            case 1:
                registerNewCustomer(bankSystem);
                break;
            case 2:
                accessCustomerAccounts(bankSystem);
                break;
            case 3:
                bankSystem.displayAllAccounts();
                waitForEnter();
                break;
            case 4:
                bankSystem.generateGlobalTransactionReport();
                waitForEnter();
                break;
            case 5:
                std::cout << "Thank you for using our Banking System. Goodbye!" << std::endl;
                return;
            default:
                std::cout << "Invalid choice. Please try again." << std::endl;
                waitForEnter();
        }
    }
}